<?
include "config.inc.php";
include "utils.inc.php";

if (!isset($_REQUEST['u'])) {
  header('Location: '.$base_url.'/');
  return;
}

$url = normalize_url($_REQUEST['u']);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, 0);
set_curl_useragent($curl);
$str = curl_exec($curl);
curl_close($curl);

$title = el_iextract($str, '<title>', '</title>');
$str = el_iextract($str, '<body>', '</body>');
$str = str_replace('<img src="/', '<img src="http://pda.atnext.com/', $str);
echo '<div title="'.$title.'">'.$str.'</div>';
?>